package com.javashow.main.factory.dao.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Repository;

import com.javashow.main.factory.dao.IModelFactoryDao;
import com.javashow.pojo.DataModelFields;

@Repository(value = "modelFactoryDao")
public class ModelFactoryDaoImpl implements IModelFactoryDao {

	@Resource
	private SessionFactory sessionFactory;
	
	@SuppressWarnings("unchecked")
	@Override
	public List<DataModelFields> queryModelByName(String modelName) {
		List<DataModelFields> result =new ArrayList<DataModelFields>();
		Query query = sessionFactory.getCurrentSession().createQuery("from DataModelFields dmf where dmf.modelName=?");
		query.setParameter(0, modelName);
		
		result = query.list();
		
		return result;
	}
	
}









